#ifndef _USR_GNSS_H
#define _USR_GNSS_H
//#include "main.h"
#define AM_LOCATION_SERVICE_RCV_TIMEOUT 15

#define AM_LOCATION_SERVICE_LOCATION_BCD_LEN 5
#define LBSLOC_SUCCESS          0x0
#define UNKNOWN_LOCATION        0x1
#define PERMISSION_ERROR        0x2
#define UNKNOWN_ERROR           0x4
#define WIFILOC_SUCCESS         0xff
typedef struct
{
    int lat;
    int lon;
    int sv;
    float spd;
    uint8_t csq;
    uint8_t fixMode;
    time_t ts;
    char *gps_status;
    float vt;//地面航向
    uint32_t Accumulated_mileage;//最大行驶里程65535公里
    uint32_t mileage;
} DEV_GNSS_T;
PACK_STRUCT_BEGIN
struct am_location_service_rsp_data_t
{
    PACK_STRUCT_FLD_8(u8_t result);
    PACK_STRUCT_FIELD(u8_t latitude[AM_LOCATION_SERVICE_LOCATION_BCD_LEN]);
    PACK_STRUCT_FIELD(u8_t longitude[AM_LOCATION_SERVICE_LOCATION_BCD_LEN]);
    PACK_STRUCT_FLD_8(u8_t year);
    PACK_STRUCT_FLD_8(u8_t month);
    PACK_STRUCT_FLD_8(u8_t day);
    PACK_STRUCT_FLD_8(u8_t hour);
    PACK_STRUCT_FLD_8(u8_t minute);
    PACK_STRUCT_FLD_8(u8_t second);
} PACK_STRUCT_STRUCT;
PACK_STRUCT_END
void usr_gnss_init(void);
int parse_nmea(const char *gnssdata, DEV_GNSS_T *usr_gnss);
static void gnss_parse_task(void *param);
void printf_into(DEV_GNSS_T *ebike_gnss);

#endif